﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo01
{
    class Program
    {
        static void Main(string[] args)
        {
            dayin();
            chenfab();
            lingxing();
            shuZhu();

        }
        public static void dayin()
        //打印实心正方形
        {
            Console.WriteLine("请输入正方形边长");
            int bianc = int.Parse(Console.ReadLine());
            for (int i = 0; i < bianc; i++)
            {
                Console.WriteLine("*");
                for (int j = 0; j < bianc - 1; j++)
                {
                    Console.Write("*");

                }
            }
            Console.ReadKey();
        }
        public static void chenfab()
        //打印九九乘法表
        {
            string[,] arr = new string[9, 9];
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    arr[i, j] = (i + 1) + "*" + (j + 1) + "=" + (i + 1) * (j + 1) + "\t";
                }
            }
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    Console.Write(arr[i, j]);
                }
                Console.WriteLine();
            }
        }
        public static void kongxinZfx()
        //用户输入正方形边长，用*打印出空心正方形
        {
            String[][] arr = new string[n][n];
        }

        public static void lingxing()
        //打印菱形
        {
            Console.WriteLine("请输入一个数");
            int n = int.Parse(Console.ReadLine());
            for (int i = 1; i <= (n + 1) / 2; i++)
            {
                for (int j = (n - 1) / 2; j >= i; j--)
                {
                    Console.WriteLine(" ");
                }
                for (int k = 1; k <= i * 2 - 1; k++)
                {
                    Console.Write("*");
                }
                Console.WriteLine();
            }
            for (int i = (n - 1) / 2; i >= 1; i--)
            {
                for (int j = i - 1; j < (n - 1) / 2; j++)
                {
                    Console.Write("");
                }
                for (int k = 1; k <= i * 2 - 1; k++)
                {
                    Console.Write("*");
                }
                Console.WriteLine();
            }
        }
        public static void shuZhu()

        //如果一个数组保存元素是有序的（从大到小），
        //向这个数组中插入一个数，使得插入后的数组元素仍然保持有序。

        {
            int a;
            int[] arr = { 2,15,26,5,8};
            Console.WriteLine("请输入一个数");
            int nuber = int.Parse(Console.ReadLine());
            for (int i = 0; i < arr.Length; i++)
            {
                if (nuber<arr[i])
                {
                    continue;
                }
                else
                {
                    a = arr[i];
                    arr[i] = nuber;
                    nuber = a;
                }
                Console.WriteLine("重新排序后的数组");
                for (int i = 0; i < arr.Length; i++)
                {
                    Console.Write(arr[i]);
                }
            }
        }
    }
}
